package com.base.dao.pms;

import com.base.vo.pms.PmsFollowItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author wnhuang
 * @Package com.base.dao.pms
 * @date 2021-1-3 16:45
 */
@Repository
public interface PmsFollowItemMapper {

    @Select("select item_code itemCode,item_name itemName from FOLLOW_ITEM where item_class='C'")
    List<PmsFollowItem> getPmsFollowTestItem();

    @Update("<script>"
            + "insert into FOLLOW_ITEM select distinct LABSUBITEMCODE,LABSUBITEMNAMECN,'C' from LAB_REPORTBIOCHEMITEM where LABSUBITEMCODE IN "
            + "<foreach item='item' index='index' collection='list' open='(' separator=',' close=')'>"
            + "#{item}"
            + "</foreach>"
            + "</script>")
    void savePmsFollowTestItem(@Param("list") List<String> list);

    @Delete("delete from FOLLOW_ITEM where item_class = #{itemClass}")
    void delPmsFollowTestItem(@Param("itemClass") String itemClass);
}
